﻿(function () {

    var someData = {
        Cars: [
            "Dacia",
            "BMW",
            "Chevrolet",
            "Mustang",
            "Dodge"
        ],
        DealerName: "Awesome Car Dealer"
    };

    setTimeout(function () {
        document.getElementById('holderForDealerName').innerHTML = someData.DealerName;

        document.getElementById('holderForCars').innerHTML = '';
        for (var i in someData.Cars) {
            document.getElementById('holderForCars').innerHTML += someData.Cars[i] + "<br />";
        }

        //A bit cooler:
        document.getElementById('holderForCars').innerHTML = someData.Cars.join("<br />");
    }, 1);


    this.onAddNewCarClick = function () {
        var name = document.getElementById('holderForNewCarName').value;
        someData.Cars.push(name);
        document.getElementById('holderForCars').innerHTML = someData.Cars.join("<br />");
    }

})
.call(window);